<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <link rel="icon" href="favicon.ico" type="image/ico">
    <meta name="keywords" content="审核">
    <meta name="author" content="yinqi">
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link href="/css/materialdesignicons.min.css" rel="stylesheet">
    <link href="/css/style.min.css" rel="stylesheet">
    <title>历史文化-发布文化</title>
</head>
<body>
<div class="row">
    <div class="col-lg-12">
        <div class="card">
            <div class="card-header"><h4>历史文化-发布文化</h4></div>
            <div class="card-body">
            <form action="/history/saveHistory" method="post" class="row" >
                <div class="form-group col-md-12">
                    <label for="historyTittle">历史文化标题</label>
                    <input type="text" class="form-control" id="historyTittle" name="historyTittle" required/>
                </div>

                <div class="form-group col-md-12"></div>
                <div class="form-group col-md-12">
                    <label for="historyContent">历史文化内容</label>
                    <div id="div1">

                    </div>
                    <input type="hidden" class="form-control" id="historyContent" name="historyContent" required>
                </div>
                <div class="form-group col-md-12">
                    <button type="submit" class="btn btn-primary ajax-post" target-form="add-form">确 定</button>
                    <button type="button" class="btn btn-default" onclick="javascript:history.back(-1);return false;">返 回</button>
                </div>
            </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="/js/main.min.js"></script>
<script type="text/javascript" src="/js/axios.min.js"></script>
<script type="text/javascript" src="/js/wangEditor.min.js"></script>
<script type="text/javascript">
    var E = window.wangEditor;
    var editor = new E('#div1');
    var $text1 = $('#historyContent');
    editor.customConfig.onchange = function (html) {
        // 监控变化，同步更新到 textarea
        $text1.val(html)
    };
    editor.customConfig.uploadImgServer = '/history/uploadHistoryImg';
    editor.customConfig.uploadImgMaxSize = 3 * 1024 * 1024;
    editor.customConfig.uploadImgMaxLength = 5;
    editor.customConfig.uploadFileName="imgFile";
    editor.customConfig.uploadImgHooks ={
        customInsert: function (insertImg, result, editor) {
            // 图片上传并返回结果，自定义插入图片的事件（而不是编辑器自动插入图片！！！）
            // insertImg 是插入图片的函数，editor 是编辑器对象，result 是服务器端返回的结果

            // 举例：假如上传图片成功后，服务器端返回的是 {url:'....'} 这种格式，即可这样插入图片：
            for (let i = 0; i < 5; i++) {
                var url = result.data[i];
                insertImg(url)
            }
            // result 必须是一个 JSON 格式字符串！！！否则报错
        }
    };
    editor.create();
    // 初始化 textarea 的值
    $text1.val(editor.txt.html())

</script>
</body>
</html>